﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefProductDataTemplates" :model="stateProductDataTemplates.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AddTime_FormItem" prop="Entity.AddTime" :label="$t('message.autotrans._Model_ProductDataTemplates_addTime')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.AddTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AddUserId_FormItem" prop="Entity.AddUserId" :label="$t('message.autotrans._Model_ProductDataTemplates_addUserId')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.AddUserId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_AddUserName_FormItem" prop="Entity.AddUserName" :label="$t('message.autotrans._Model_ProductDataTemplates_addUserName')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.AddUserName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_DataSource_FormItem" prop="Entity.DataSource" :label="$t('message.autotrans._Model_ProductDataTemplates_dataSource')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.DataSource" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_DataSourceCode_FormItem" prop="Entity.DataSourceCode" :label="$t('message.autotrans._Model_ProductDataTemplates_dataSourceCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.DataSourceCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_DataStatus_FormItem" prop="Entity.DataStatus" :label="$t('message.autotrans._Model_ProductDataTemplates_dataStatus')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.DataStatus" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditTime_FormItem" prop="Entity.EditTime" :label="$t('message.autotrans._Model_ProductDataTemplates_editTime')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.EditTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditUserId_FormItem" prop="Entity.EditUserId" :label="$t('message.autotrans._Model_ProductDataTemplates_editUserId')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.EditUserId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EditUserName_FormItem" prop="Entity.EditUserName" :label="$t('message.autotrans._Model_ProductDataTemplates_editUserName')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.EditUserName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EnableStatus_FormItem" prop="Entity.EnableStatus" :label="$t('message.autotrans._Model_ProductDataTemplates_enableStatus')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.EnableStatus" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EquCode_FormItem" prop="Entity.EquCode" :label="$t('message.autotrans._Model_ProductDataTemplates_equCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.EquCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EquName_FormItem" prop="Entity.EquName" :label="$t('message.autotrans._Model_ProductDataTemplates_equName')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.EquName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_FactoryCode_FormItem" prop="Entity.FactoryCode" :label="$t('message.autotrans._Model_ProductDataTemplates_factoryCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.FactoryCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationCode_FormItem" prop="Entity.OperationCode" :label="$t('message.autotrans._Model_ProductDataTemplates_operationCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.OperationCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OperationName_FormItem" prop="Entity.OperationName" :label="$t('message.autotrans._Model_ProductDataTemplates_operationName')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.OperationName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamCode_FormItem" prop="Entity.ParamCode" :label="$t('message.autotrans._Model_ProductDataTemplates_paramCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamCodeKey_FormItem" prop="Entity.ParamCodeKey" :label="$t('message.autotrans._Model_ProductDataTemplates_paramCodeKey')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProductDataTemplates_paramCodeKey')}), trigger: 'blur' }]" >
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamCodeKey" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamName_FormItem" prop="Entity.ParamName" :label="$t('message.autotrans._Model_ProductDataTemplates_paramName')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamName" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamNameKey_FormItem" prop="Entity.ParamNameKey" :label="$t('message.autotrans._Model_ProductDataTemplates_paramNameKey')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamNameKey" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamRange1_FormItem" prop="Entity.ParamRange1" :label="$t('message.autotrans._Model_ProductDataTemplates_paramRange1')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamRange1" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamRange2_FormItem" prop="Entity.ParamRange2" :label="$t('message.autotrans._Model_ProductDataTemplates_paramRange2')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamRange2" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamUnit_FormItem" prop="Entity.ParamUnit" :label="$t('message.autotrans._Model_ProductDataTemplates_paramUnit')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamUnit" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ParamValueKey_FormItem" prop="Entity.ParamValueKey" :label="$t('message.autotrans._Model_ProductDataTemplates_paramValueKey')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.ParamValueKey" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Sort_FormItem" prop="Entity.Sort" :label="$t('message.autotrans._Model_ProductDataTemplates_sort')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.Sort" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StandardValue_FormItem" prop="Entity.StandardValue" :label="$t('message.autotrans._Model_ProductDataTemplates_standardValue')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.StandardValue" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_StationCode_FormItem" prop="Entity.StationCode" :label="$t('message.autotrans._Model_ProductDataTemplates_stationCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.StationCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_TemplateCode_FormItem" prop="Entity.TemplateCode" :label="$t('message.autotrans._Model_ProductDataTemplates_templateCode')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProductDataTemplates_templateCode')}), trigger: 'blur' }]" >
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.TemplateCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UniqueCode_FormItem" prop="Entity.UniqueCode" :label="$t('message.autotrans._Model_ProductDataTemplates_uniqueCode')">
            <el-input v-model="stateProductDataTemplates.vmModel.Entity.UniqueCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onCloseProductDataTemplates"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageGetDataProductDataTemplatesDetails;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { productdatatemplatesApi } from '/@/api/getdata/productdatatemplates';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefProductDataTemplates = ref();
const stateProductDataTemplates = reactive({
    vmModel: {
	  Entity:{
        AddTime: '',
        AddUserId: '',
        AddUserName: '',
        DataSource: '',
        DataSourceCode: '',
        DataStatus: '',
        EditTime: '',
        EditUserId: '',
        EditUserName: '',
        EnableStatus: '',
        EquCode: '',
        EquName: '',
        FactoryCode: '',
        OperationCode: '',
        OperationName: '',
        ParamCode: '',
        ParamCodeKey: '',
        ParamName: '',
        ParamNameKey: '',
        ParamRange1: '',
        ParamRange2: '',
        ParamUnit: '',
        ParamValueKey: '',
        Sort: null,
        StandardValue: '',
        StationCode: '',
        TemplateCode: '',
        UniqueCode: '',
        ID:null,
      },

	},
    
});

// 取消
const onCloseProductDataTemplates = () => {
    closeDialog();
};

// 提交
const onSubmitProductDataTemplates = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefProductDataTemplates.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            productdatatemplatesApi().edit(stateProductDataTemplates.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
	})
};

// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		stateProductDataTemplates.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateProductDataTemplates.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	productdatatemplatesApi().get(stateProductDataTemplates.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateProductDataTemplates.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

